package edu.bbk.muc.lifetracker.common;

/**
 * Instance of {@link Configuration} will be passed down to sensors layer every
 * time when user changes preferences, e.g. enables or disables logging in
 * general or certain sensor.
 * @author irenatyler and romankirillov
 */
public interface Configuration {
  public static class SimpleConfiguration implements Configuration {
    final boolean loggingEnabled;
    final boolean accelerationEnabled;
    final boolean ambientLightEnabled;
    final boolean locationEnabled;

    public SimpleConfiguration(boolean loggingEnabled, boolean accelerationEnabled,
        boolean ambientLightEnabled, boolean locationEnabled) {
      super();
      this.loggingEnabled = loggingEnabled;
      this.accelerationEnabled = accelerationEnabled;
      this.ambientLightEnabled = ambientLightEnabled;
      this.locationEnabled = locationEnabled;
    }

    @Override
    public boolean isAccelerationEnabled() {
      return accelerationEnabled;
    }

    @Override
    public boolean isAmbientLightEnabled() {
      return ambientLightEnabled;
    }

    @Override
    public boolean isLocationEnabled() {
      return locationEnabled;
    }

    @Override
    public boolean isLoggingEnabled() {
      return loggingEnabled;
    }
  }

  public static final Configuration ALL_ENABLED = new Configuration() {
    @Override
    public boolean isAccelerationEnabled() {
      return true;
    }

    @Override
    public boolean isAmbientLightEnabled() {
      return true;
    }

    @Override
    public boolean isLocationEnabled() {
      return true;
    }

    @Override
    public boolean isLoggingEnabled() {
      return true;
    }
  };

  boolean isAccelerationEnabled();

  boolean isAmbientLightEnabled();

  boolean isLocationEnabled();

  boolean isLoggingEnabled();
}
